package com.jxpowernode.bitcon.service.douyinservice;

import com.alibaba.fastjson.JSONObject;
import com.jxpowernode.bitcon.Constants;
import com.jxpowernode.bitcon.bean.douyin.HotVideo;
import com.jxpowernode.bitcon.bean.douyin.HotVideoCommon;
import com.jxpowernode.bitcon.request.HttpUtils;

import java.util.List;

/**
 * @Author: Lixuewei
 * @Email:1410511702@qq.com
 * @Desc: 该类用于对热点视频的封装
 * @Date: 2021/12/7 16:11
 */
public class HotVideoService {

    /**
     * 该方法用于获取热门数据，并将热门数据返回
     * @return
     */
    public List<HotVideo> getHotVideo(){
        String url = Constants.TRIP_URL
                + "?key=" + Constants.TRIP_KEY
                + "&type=hot_video"
                + "&size=5";
        String result = HttpUtils.get(url);
        //json解析
        HotVideoCommon common = JSONObject.parseObject(result, HotVideoCommon.class);
        return common.result;
    }
}
